import time
import os
from loguru import logger

logfile = "test_11.log"
logger.add(logfile)
logger.debug("123")

os.remove(logfile)
time.sleep(1)
logger.debug("456")

""" 运行结果: 没有报错, 异常

"""